package pkg

import (
	"encoding/json"
	"fmt"
	"github.com/Baidu-AIP/golang-sdk/aip/censor"
)

type BDResp struct {
	ConclusionType uint64 `json:"conclusionType"`
}

func TextCensor(message string) bool {
	client := censor.NewClient("VNhSBuxBm1O7fK7tOnWRbCzY", "xhrA526oHzyS6rSkKpoA6IRGUISEpsjT")
	//如果是百度云ak sk,使用下面的客户端

	res := client.TextCensor(message)
	fmt.Println(res)
	var resp BDResp
	_ = json.Unmarshal([]byte(res), &resp)
	if resp.ConclusionType == 1 {
		return true
	}
	return false
}
